home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / lib / udev / logger.agent < prev    next >
Encoding:
Text File  |  2010-12-12  |  614 b   |  33 lines

  1. #!/bin/sh -e
  2. #
  3. # log the event to a file
  4. #
  5.  
  6. cd /lib/udev/
  7. . ./hotplug.functions
  8.  
  9. # provide env-like output when the real thing is not available
  10. if [ ! -x /usr/bin/env ]; then
  11.     env() {
  12.         # bash prepends "declare -x " at the beginning of each line
  13.         export -p | sed -e 's/^\(declare -x\|export\) //'
  14.     }
  15. fi
  16.  
  17. # writes a copy of the current hotplug event to stdout
  18. log_to_stdout()
  19. {
  20.     {
  21.     echo "HOTPLUG_TIME='$(date)'"
  22.     env
  23.     echo ''
  24.     } | egrep -v "^'$|^(_|PATH|PWD|PPID|SHLVL|HOME|IFS|OPTIND|PS[1234])="
  25. }
  26.  
  27. [ "$EVENTS_LOG" ] || EVENTS_LOG='/dev/hotplug.log'
  28.  
  29. log_to_stdout >> $EVENTS_LOG
  30.  
  31. exit 0
  32.  
  33.